home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / tclx7_31.z / tclx7_31 / tcldev / tclX7.3a-p1 / tests / stringfil.test < prev    next >
Encoding:
Text File  |  1994-01-23  |  1.5 KB  |  55 lines

  1. #
  2. # stringfil.test
  3. #
  4. # Tests for tcl.tlib string file I/O functions.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992-1993 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: stringfil.test,v 3.0 1993/11/19 06:58:12 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] == ""} then {source testlib.tcl}
  20. eval $SAVED_UNKNOWN
  21.  
  22. set stringfileTestVar {a
  23. b
  24. c
  25. d
  26. e
  27. f
  28. g}
  29.  
  30. unlink -nocomplain STRINGFIL.TEST
  31.  
  32. Test stringfile-1.1 {write_file command} {
  33.     write_file STRINGFIL.TEST $stringfileTestVar
  34. } 0 {}
  35.  
  36. Test stringfile-2.1 {read_file command} {
  37.     read_file STRINGFIL.TEST
  38. } 0 "$stringfileTestVar\n"
  39.  
  40. Test stringfile-2.2 {read_file command} {
  41.     read_file  -nonewline STRINGFIL.TEST
  42. } 0 $stringfileTestVar
  43.  
  44. Test stringfile-2.3 {read_file command} {
  45.     read_file STRINGFIL.TEST 3
  46. } 0 [crange $stringfileTestVar 0 2]
  47.  
  48. Test stringfile-2.4 {read_file command} {
  49.     read_file STRINGFIL.TEST nonewline
  50. } 0 $stringfileTestVar
  51.  
  52. unlink STRINGFIL.TEST
  53. rename unknown {}
  54.  
  55.